<template>
	<div>
		<Head></Head>
			<div style="padding:12px;">
			<div style="display:flex;">
				<el-avatar shape="square" :size="50" :src="user.pic"></el-avatar>
				<div>
					<p>{{user.username}}</p>
					<p>{{formatDate(user.create_time)}}</p>
				</div>
			</div>
			<el-form inline :model="formInline" class="demo-form-inline">
				<el-form-item label="真实姓名">
					<el-input v-model="user2.real_name" placeholder="真实姓名"></el-input>
				</el-form-item>
				<el-form-item label="身份证号">
					<el-input v-model="user2.id_card" placeholder="身份证号码"></el-input>
				</el-form-item>
				<el-form-item label="手机号码">
					<el-input v-model="user.phone" placeholder="手机号"></el-input>
				</el-form-item>
				<el-form-item label="地区">
					<el-input  v-model="user.region" placeholder="长沙"></el-input>
				</el-form-item>
				<el-form-item label="职业">
					<el-input  v-model="user2.occupation" placeholder="职业"></el-input>
				</el-form-item>
			</el-form>
			<div v-for="value,key,index in infos" :Key="key">
				<span>{{key}}</span>:<span>{{value}}</span>
			</div>
		</div>
	</div>
</template>

<script>
	import Head from "@/components/Head.vue"
	import EmptyBox from "@/components/EmptyBox.vue"
	import { getDetail } from "../api/jsoup"
	import { formatDate } from "../api/easyUtil"
	export default {
		name: "Myself",
		components: {
			Head,
			EmptyBox
		},
		data() {
			return {
				infos:{},
				user:{},
				user2:{},
			}
		},
		methods: {
			
		},
		mounted() {
			if($.cookie("user")) this.user = JSON.parse($.cookie("user"));	
			if(this.user.id!=undefined){
				getDetail({table:"detail_users",id:this.user.id},(data)=>{
					let res = eval("(" + data + ")");
					this.user2 = res;
				});
			} else {
				this.$message({
					message: '请登录！',
					type: 'warning'
				});
			}
		}

	}
</script>

<style>
</style>
